<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ClienteConsultarLogica
 *
 * @author Sondy
 */
class ClienteConsultarLogica extends Comando {
    private $dbClienteDao = null;
    private $id = null;
    private $cliente = null;

    function __construct($id) {
        $this->id = $id;
    }

    /**
     * Retorna un Cliente, dado un id
     * @return Cliente
     */
    public function hacer() {
        try {
            $FabricaDAO = FabricaDAO::crearFabricaMySQLDAO();
            $this->dbClienteDao = $FabricaDAO->crearDBClienteDAO();
            $this->cliente = $this->dbClienteDao->select( $this->id );
        } catch ( DBClienteDAOException $Ex ) {
            throw new ClienteLogicaException("Imposible concetar a la base de datos intente de nuevo", 1);
        }

        if( $this->cliente != false ) {
            return $this->cliente;
        } else {
            return false;
        }

    }
}
?>
